This function rounds a floating-point number (LReal) to a specified number of decimal places.
| LGF_RoundByPrecision (FC) | ||||||||
|---|---|---|---|---|---|---|---|---|
| LReal | number | Ret_Val | LReal | |||||
| UInt | precisionDecimal | |||||||
| Identifier | Data type | Description |
|---|---|---|
| number | LReal | Value to be rounded |
| precisionDecimal | UInt | Number of decimal places to round the number (1,2,3) |
| Identifier | Data type | Description |
|---|---|---|
| Ret_Val | LReal | Number rounded with the number of decimal places selected |
This function rounds a floating-point number (LReal) to a specified number of decimal places.
It scales the value, truncates it to an integer, and then re-scales it to produce the rounded result.
| Version & Date | Change description | |
|---|---|---|
| 1.0.0 | Siemens Industry Online Support | |
| 30.07.2025 | First released version | |